<?php
namespace App\Api\V1\Models;

use Illuminate\Database\Eloquent\Model;

class Article extends Model
{
    protected $table = 'article';
    public $timestamps = false;
    public function addArticleItem(){
        $ds = [
            'article_cat_id' => '30',
            'title' => '南京',
            'image' => 'careyshop.oruei.com/uploads/files/20191206/47a84479bcfa0c379cc40a37febb4f9a.png?type=careyshop',
            'content' => '内容',
            'source' => '社区',
            'source_url' => 'http://www.baidu.com',
        ];

        $this->article_cat_id = $ds['article_cat_id'];
        $this->title = $ds['title'];
        $this->image = $ds['image'];
        $this->content = $ds['content'];
        $this->source = $ds['source'];
        $this->source_url = $ds['source_url'];

        if($this->save()){
            return $this->toArray();
        }
        return false;
    }

    public function delArticleList(){
        return '我是批量删除文章';
    }

    public function getArticleItem(){
        return '我是获取一篇文章';
    }

    public function getArticleList(){
        return '我是获取文章列表';
    }

    public function setArticleItem()
    {
        return '我是编辑一篇文章';
    }

    public function setArticleTop(){
        return '我是批量设置文章置顶';
    }

    public function setArticleStatus(){
        return '我是批量设置文章是否显示';
    }
}
